package club.adger.server.service.impl;

import club.adger.server.entity.Test;
import club.adger.server.mapper.TestMapper;
import club.adger.server.service.TestService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: Adger
 * @Date: 2020/07/23/9:11
 */
@Service
public class TestServiceImpl implements TestService {
    @Resource
    private TestMapper testMapper;

    /**
     * 查询所有
     * @return
     */
    @Override
    public List<Test> list() {

        return testMapper.selectByExample(null);
    }

    /**
     * 这里按照查询条件来排序 使用示列
     * id asc 从小到大
     * @return
     */
   /* @Override
    public List<Test> list() {
        TestExample testExample = new TestExample();
        testExample.setOrderByClause("id asc");
        return testMapper.selectByExample(testExample);
    }*/

    /**
     *createCriteria 相当于 where 条件
     */
     /* @Override
    public List<Test> list() {
        TestExample testExample = new TestExample();
        testExample.createCriteria().andIdEqualTo(1);
        testExample.setOrderByClause("id asc");
        return testMapper.selectByExample(testExample);
    }*/
}
